loop_count = 0

function tarai(x, y, z)
   loop_count = loop_count + 1

   if y < x then
      return tarai(tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y))
   end
   return y
end

print(tarai(12, 6, 0))
print(loop_count)
